<template>
  <div class="count">
    <div class="count-row">
      <div class="item">
        <i class="xffont font-gongsi"></i>
        <span class="text">今日新增用人单位</span>
        <span class="num">
        <grow-num :value="Number(list.corpCount || 0)"></grow-num>
      </span>
        <span>家</span>
      </div>
      <div class="item">
        <i class="xffont font-renshu"></i>
        <span class="text">今日新增求职者</span>
        <span class="num">
        <grow-num :value="Number(list.applyJobCount || 0)"></grow-num>
      </span>
        <span>人</span>
      </div>
      <div class="item">
        <i class="xffont font-icon-project"></i>
        <span class="text">今日新增注册简历</span>
        <span class="num">
        <grow-num :value="Number(list.registerBaseCount || 0)"></grow-num>
      </span>
        <span>个</span>
      </div>
    </div>
    <div class="count-row">
      <div class="item">
        <i class="xffont font-bisaihuodong"></i>
        <span class="text">今日达成意向数</span>
        <span class="num">
        <grow-num :value="Number(list.wantCount || 0)"></grow-num>
      </span>
        <span>个</span>
      </div>
      <div class="item">
        <i class="xffont font-zhiwei"></i>
        <span class="text">今日新增岗位</span>
        <span class="num">
        <grow-num :value="Number(list.jobCount || 0)"></grow-num>
      </span>
        <span>个</span>
      </div>
      <div class="item">
        <i class="xffont font-user-list"></i>
        <span class="text">今日新增岗位需求</span>
        <span class="num">
        <grow-num :value="Number(list.jobWantCount || 0)"></grow-num>
      </span>
        <span>人</span>
      </div>
    </div>
    <div class="count-row">
      <div class="item">
        <i class="xffont font-jianli-copy"></i>
        <span class="text">今日单位收到简历</span>
        <span class="num">
        <grow-num :value="Number(list.reviceCount || 0)"></grow-num>
      </span>
        <span>个</span>
      </div>
      <div class="item">
        <i class="xffont font-jianli-copy"></i>
        <span class="text">今日求职者收到面试邀请数</span>
        <span class="num">
          <grow-num :value="Number(list.reviewCount || 0)"></grow-num>
        </span>
        <span>个</span>
      </div>
    </div>
  </div>
</template>
<script>
import {fallRise} from '../../common/js/mixin'
import GrowNum from '../grow-num/grow-num.vue'
import {INTERVAL, STATIC_WANT} from '../../common/js/config'

export default {
  components: {GrowNum},
  name: 'new-count-m',
  mixins: [fallRise],
  data() {
    return {
      list: {
        corpCount: '', // 单位数
        applyJobCount: '', // 求职数
        projectCount: '', // 项目数
        smsCount: '', // 招聘信息数
        registerBaseCount: '', // 新增注册简历数
        wantCount: '', // 今日达成意向数
        jobCount: '', // 今日新增岗位数
        jobWantCount: '', // 今日新增岗位需求数
        reviewCount: '' // 今日求职者收到面试邀请数
      }
    }
  },
  methods: {
    getData() {
      this.$post('/service/business/statistic/statistic/getTodayStatistic').then(res => {
        this.list = res.result || {}
        this.list.wantCount = Number(this.list.wantCount) + STATIC_WANT
      })
    },
    start() {
      clearInterval(this.timer)
      this.getData()
      this.timer = setInterval(() => {
        this.getData()
      }, INTERVAL)
    }
  },
  created() {
    this.start()
  }
}
</script>
<style lang="scss" scoped>
  @import "../../common/style/variables";
  .count{
    height: 100%;
    width: 100%;
    background: rgba(9,44,99,.5);
    border-radius: 8px;
  }
  .count-row{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 33.3%;
  }
  .item{
    flex: 1;
    position: relative;
    color: #fff;
    padding: 0 0 0 15px;
    display: flex;
    align-items: baseline;
    .xffont{
      color: #fff;
      font-size: 18px;
      margin-right: 5px;
    }
    .text{
      color: #ffcd75;
      font-size: 14px;
    }
    .num{
      font-size: 22px;
      color: #fff;
      margin: 0 5px;
    }
  }
</style>
